<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>页面提示</title>
<style>
html, body {margin:0; padding:0; font:14px/1.5 Arial, sans-serif; background: #fff;}
a {color: #2a6496; text-decoration: none;}
a:hover {text-decoration: underline;}
.box { width: 45%; padding: 15px; border: 1px solid #e1e1e1; margin: 10% auto 0; text-align:center; }
.success, .wait {color: #47a447;}
.error { color: #d2322d; }
.tip { color: #333;}
</style>
</head>
<body>
	<present name="message">
  <div class="box success">
    <p class="msg">{$msgTitle}{$message}</p>
	<else/>
  <div class="box error">
    <p class="msg">{$msgTitle}{$error}</p>
	</present>
	<p class="tip">
	<present name="closeWin" >
		页面将在 <span class="wait" id="J_wait">{$waitSecond}</span> 秒后自动关闭，如果不想等待请点击 <a href="{$jumpUrl}">这里</a> 关闭
	<else/>
		页面将在 <span class="wait" id="J_wait">{$waitSecond}</span> 秒后自动跳转，如果不想等待请点击 <a href="{$jumpUrl}">这里</a> 跳转
	</present>
	</p>
</div>
<script type="text/javascript">
var now = function() {
  return Date.now() || (new Date()).getTime();
}

var interval = function(fn, time) {
  var nextAt = now() + time;
  var timer;

  var wrapper = function() {
    nextAt += time;
    timer = setTimeout(wrapper, nextAt - now());
    return fn();
  }

  var clear = function() {
    return clearTimeout(timer);
  }

  timer = setTimeout(wrapper, nextAt - now());

  return {
    clear: clear
  }
}

var el = document.getElementById('J_wait');
var n = {$waitSecond};
var timer = interval(function() {
  if (--n) {
    el.innerHTML = n;
  } else {
    timer.clear();
    location.href = "{$jumpUrl}";
  }
}, 1000);

</script>
</body>
</html>
